/*
 * @Description: emp接口的实现类
 * @Author: liuzl
 * @Date: 2024-12-04 14:58:38
 * @LastEditors: liuzl
 * @LastEditTime: 2024-12-04 15:14:27
 */
package com.briup.service.impl;

import com.briup.dao.EmpMapper;
import com.briup.dao.impl.EmpDaoImpl;
import com.briup.pojo.Emp;
import com.briup.service.IEmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component//类交给IOC容器管理
public class EmpServiceImpl implements IEmpService {
    // 获取dao层的对象
//    private EmpMapper empDao = new EmpDaoImpl();
    @Autowired
    private EmpMapper empDao;
    @Override
    public Emp getEmpById(Integer id) {
        Emp emp = empDao.getById(id);
        //处理具体的业务逻辑
        //处理性别
        Short gender = emp.getGender();
        if (gender != null) {
            if (gender == 1) {
                emp.setGenderStr("男");
            }else if (gender == 2){
                emp.setGenderStr("女");
            }
        }
        //处理job
        return emp;
    }

}
